Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

1.7.11

Block commenting in TCL script

Simple procedure outlined in tcl wiki
 # First, define an block comment procedure, as:
  proc /* {args} {}
  # Then,you can use it as:
  /* { ...
  .. any comments,(with carefull { } pairs).
  } and more args in this line will be ignored.

Running tcl codes

Running tcl codes requires tclsh
Example $tclsh

Example tcl code to print out values:

# tcl script test for multiple loops
#tcl script test for multiple loops
#purpose: to check the value of val
#
set val 0
set tal 0
set num_apps 1
set num_of_tel_nodes 5
for {set nn 1} {$nn < $num_of_tel_nodes} {incr nn} {
 set tal [expr [expr $nn * $num_apps] + 1]
         for { } {$val < $tal} {incr val} {
            puts stdout  " $val"
        }
}
 puts stdout "###############################"
set num_of_vo_nodes 3
 for {set nn 1} {$nn < $num_of_vo_nodes} {incr nn} {
     set tal [expr [expr [expr $nn * $num_apps] + $num_of_tel_nodes] + 1]
         for { } {$val < $tal} {incr val} {
              puts stdout  " $val"
          }
 }





22.6.11

Suppress Warnings in g++ v4.0

Warning suppression is not recommended as it displays issues with the compiler, which could effect the result. However when compiling old codes, a lot of warning generates noise and makes it hard to locate errors in the program. In such cases, using such warning suppresses might just help in gnu C++ code
-Wno : Suppress Warnings
-Wno-write-strings
Go to GCC home page for other compiler options

26.8.10

Embedding C++ api to RoR

1. gem install rice. Rice is a C++ api to wrap in C++ classes, methods and structure in ruby.

12.7.10

Image and rails

Rails image manipulation

25.6.10

Display source code with line number in blog

...From the author of the link
Today I realized that it will be better to have line numbers shown with the parts of code I publish into this blog.
I tried with google but didn't find any "easy" way to do it.
So I figured out my way which I am going to describe here!
First of all I wanted to show line numbers for the code but I also wanted the visitors to be able to copy the code without the line numbers....

converting integer to string with same number of digits


            int num = j;
            int numDigits = 0;
            while (num>0)
            {
                numDigits++;
                num/=10;
            }

            std::string zeroes;
            if (numDigits == 1)
                zeroes = "000";
            else
                zeroes = "00";

            std::string s;
            std::stringstream out ;
            out << j;
            s = out.str();

            url = url + zeroes ;
            url = url + s;
            url = url + ".jpg";

24.6.10

curl webpages to yourself

curl is a command line tool for transferring data with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, IMAP, SMTP, POP3, RTMP and RTSP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos...), file transfer resume, proxy tunneling and a busload of other

15.6.10

Ruby Installation issues

1. install ruby ./configure --prefix= --enable-shared [to use shared libraries for future]
2. install ruby gems
3. use gems to install rails and other items.. check ri and rdoc for documentation
4. Whenver the installation screws up
gem update --system
 gem update rails
 gem install --version=1.2.3 sqlite3-ruby

19.1.10

Inverse Sentence Frequency

Use ISF to remove stop words from the document
m = length of a document
t = frequency of a term in a document
ISF = log2((m-t)/m))

19.6.09

Two Best Friends for Programmers

[gdb-help]: http://heather.cs.ucdavis.edu/~matloff/UnixAndC/CLanguage/Debug.html#tth_sEc4.3

[git-help] http://www.gitready.com/